package com.zcedu.dao.impl;

import com.zcedu.bean.User;
import com.zcedu.dao.UserDao;
import com.zcedu.utils.JDBCUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

public class UserDaoImpl implements UserDao {
    public User login(User inputUser) throws Exception {
        return new QueryRunner(JDBCUtils.getDataSource())
                .query("select * from tb_user where username = ? and password = ?",
                        new BeanHandler<User>(User.class),
                        inputUser.getUsername(),
                        inputUser.getPassword());
    }
}
